.class Lcom/opongo/blogapp/manager/DatabaseManager$OpenHelper;
.super Landroid/database/sqlite/SQLiteOpenHelper;
.source "DatabaseManager.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/opongo/blogapp/manager/DatabaseManager;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0xa
    name = "OpenHelper"
.end annotation


# static fields
.field protected static final DATABASE_NAME:Ljava/lang/String; = "blogapp.db"

.field protected static final DATABASE_VERSION:I = 0xf


# direct methods
.method constructor <init>(Landroid/content/Context;)V
    .locals 3
    .parameter "context"

    .prologue
    .line 793
    const-string v0, "blogapp.db"

    const/4 v1, 0x0

    const/16 v2, 0xf

    invoke-direct {p0, p1, v0, v1, v2}, Landroid/database/sqlite/SQLiteOpenHelper;-><init>(Landroid/content/Context;Ljava/lang/String;Landroid/database/sqlite/SQLiteDatabase$CursorFactory;I)V

    .line 794
    return-void
.end method


# virtual methods
.method public onCreate(Landroid/database/sqlite/SQLiteDatabase;)V
    .locals 10
    .parameter "db"

    .prologue
    const-wide/16 v8, 0x1

    const-wide/16 v6, 0x0

    const/4 v5, 0x3

    const/4 v4, 0x2

    const/4 v3, 0x1

    .line 805
    sget-boolean v1, Lcom/opongo/blogapp/manager/DatabaseManager;->DEBUG:Z

    if-eqz v1, :cond_0

    .line 806
    sget-object v1, Lcom/opongo/blogapp/manager/DatabaseManager;->TAG:Ljava/lang/String;

    const-string v2, "onCreate database"

    invoke-static {v1, v2}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 808
    :cond_0
    const-string v1, "CREATE TABLE recent_posts (_id INTEGER PRIMARY KEY AUTOINCREMENT,id INTEGER,title TEXT NOT NULL,date TEXT NOT NULL,content TEXT NOT NULL,categories TEXT,commentscount INTEGER,imageurl TEXT,post_order INTEGER,guid TEXT,opened INTEGER,newpost INTEGER,did_vote INTEGER,post_author TEXT,post_price DOUBLE,post_rating DOUBLE);"

    invoke-virtual {p1, v1}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 809
    const-string v1, "CREATE TABLE mostread_posts (_id INTEGER PRIMARY KEY AUTOINCREMENT,id INTEGER,title TEXT NOT NULL,date TEXT NOT NULL,content TEXT NOT NULL,categories TEXT,commentscount INTEGER,imageurl TEXT,post_order INTEGER,guid TEXT,opened INTEGER,newpost INTEGER);"

    invoke-virtual {p1, v1}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 810
    const-string v1, "CREATE TABLE mostcommented_posts (_id INTEGER PRIMARY KEY AUTOINCREMENT,id INTEGER,title TEXT NOT NULL,date TEXT NOT NULL,content TEXT NOT NULL,categories TEXT,commentscount INTEGER,imageurl TEXT,post_order INTEGER,guid TEXT,opened INTEGER,newpost INTEGER);"

    invoke-virtual {p1, v1}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 811
    const-string v1, "CREATE TABLE comments (_id INTEGER PRIMARY KEY AUTOINCREMENT,id INTEGER,parent INTEGER,postid INTEGER NOT NULL,content TEXT NOT NULL,author TEXT,date TEXT NOT NULL,gravatarurl TEXT);"

    invoke-virtual {p1, v1}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 812
    const-string v1, "CREATE TABLE search_posts (_id INTEGER PRIMARY KEY AUTOINCREMENT,id INTEGER,title TEXT NOT NULL,date TEXT NOT NULL,content TEXT NOT NULL,categories TEXT,commentscount INTEGER,imageurl TEXT,post_order INTEGER,guid TEXT,opened INTEGER,newpost INTEGER,did_vote INTEGER,post_author TEXT,post_price DOUBLE,post_rating DOUBLE);"

    invoke-virtual {p1, v1}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 813
    const-string v1, "CREATE TABLE bookmarks (_id INTEGER PRIMARY KEY AUTOINCREMENT,id INTEGER,title TEXT NOT NULL,date TEXT NOT NULL,content TEXT NOT NULL,categories TEXT,commentscount INTEGER,imageurl TEXT,post_order INTEGER,guid TEXT,opened INTEGER,newpost INTEGER,did_vote INTEGER,post_author TEXT,post_price DOUBLE,post_rating DOUBLE);"

    invoke-virtual {p1, v1}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 814
    const-string v1, "CREATE TABLE categories (_id INTEGER PRIMARY KEY AUTOINCREMENT,id INTEGER,cat_name TEXT NOT NULL,cat_parent INTEGER,cat_enable INTEGER,cat_new INTEGER,cat_child_count INTEGER,cat_show_enable INTEGER);"

    invoke-virtual {p1, v1}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 817
    const-string v1, "CREATE UNIQUE INDEX idx_recent_posts ON recent_posts (id);"

    invoke-virtual {p1, v1}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 818
    const-string v1, "CREATE UNIQUE INDEX idx_mostread_posts ON mostread_posts (id);"

    invoke-virtual {p1, v1}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 819
    const-string v1, "CREATE UNIQUE INDEX idx_comments_id ON comments (id);"

    invoke-virtual {p1, v1}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 820
    const-string v1, "CREATE UNIQUE INDEX idx_mostcommented_posts ON mostcommented_posts (id);"

    invoke-virtual {p1, v1}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 821
    const-string v1, "CREATE UNIQUE INDEX idx_search_posts ON search_posts (id);"

    invoke-virtual {p1, v1}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 822
    const-string v1, "CREATE UNIQUE INDEX idx_bookmarks ON bookmarks (id);"

    invoke-virtual {p1, v1}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 823
    const-string v1, "CREATE UNIQUE INDEX idx_categories ON categories (id);"

    invoke-virtual {p1, v1}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 826
    const-string v1, "CREATE TABLE blogtyp (_id INTEGER PRIMARY KEY AUTOINCREMENT,tablename TEXT NOT NULL,blogtype INTEGER NOT NULL,title TEXT NOT NULL,date TEXT);"

    invoke-virtual {p1, v1}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 827
    const-string v1, "CREATE UNIQUE INDEX idx_blogtyp ON blogtyp (tablename, blogtype);"

    invoke-virtual {p1, v1}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 829
    const-string v1, "CREATE TABLE post_blogtype (post_id INTEGER,blogtype_id INTEGER,newpost INTEGER,post_order INTEGER);"

    invoke-virtual {p1, v1}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 830
    const-string v1, "CREATE UNIQUE INDEX idx_post_blogtype ON post_blogtype (post_id, blogtype_id);"

    invoke-virtual {p1, v1}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 832
    const-string v1, "INSERT INTO blogtyp (tablename,blogtype,title,date) VALUES (?,?,?,?);"

    invoke-virtual {p1, v1}, Landroid/database/sqlite/SQLiteDatabase;->compileStatement(Ljava/lang/String;)Landroid/database/sqlite/SQLiteStatement;

    move-result-object v0

    .line 835
    .local v0, insertStmt:Landroid/database/sqlite/SQLiteStatement;
    const-string v1, "recent_posts"

    invoke-virtual {v0, v3, v1}, Landroid/database/sqlite/SQLiteStatement;->bindString(ILjava/lang/String;)V

    .line 836
    invoke-virtual {v0, v4, v6, v7}, Landroid/database/sqlite/SQLiteStatement;->bindLong(IJ)V

    .line 837
    const-string v1, "Aktuelles"

    invoke-virtual {v0, v5, v1}, Landroid/database/sqlite/SQLiteStatement;->bindString(ILjava/lang/String;)V

    .line 838
    invoke-virtual {v0}, Landroid/database/sqlite/SQLiteStatement;->executeInsert()J

    .line 840
    const-string v1, "recent_posts"

    invoke-virtual {v0, v3, v1}, Landroid/database/sqlite/SQLiteStatement;->bindString(ILjava/lang/String;)V

    .line 841
    invoke-virtual {v0, v4, v8, v9}, Landroid/database/sqlite/SQLiteStatement;->bindLong(IJ)V

    .line 842
    const-string v1, "Meistgelesen"

    invoke-virtual {v0, v5, v1}, Landroid/database/sqlite/SQLiteStatement;->bindString(ILjava/lang/String;)V

    .line 843
    invoke-virtual {v0}, Landroid/database/sqlite/SQLiteStatement;->executeInsert()J

    .line 845
    const-string v1, "recent_posts"

    invoke-virtual {v0, v3, v1}, Landroid/database/sqlite/SQLiteStatement;->bindString(ILjava/lang/String;)V

    .line 846
    const-wide/16 v1, 0x2

    invoke-virtual {v0, v4, v1, v2}, Landroid/database/sqlite/SQLiteStatement;->bindLong(IJ)V

    .line 847
    const-string v1, "Meistkommentiert"

    invoke-virtual {v0, v5, v1}, Landroid/database/sqlite/SQLiteStatement;->bindString(ILjava/lang/String;)V

    .line 848
    invoke-virtual {v0}, Landroid/database/sqlite/SQLiteStatement;->executeInsert()J

    .line 851
    const-string v1, "CREATE TABLE spicydeals (_id INTEGER PRIMARY KEY AUTOINCREMENT,id INTEGER,title TEXT NOT NULL,date TEXT NOT NULL,content TEXT NOT NULL,categories TEXT,commentscount INTEGER,imageurl TEXT,post_order INTEGER,guid TEXT,opened INTEGER,newpost INTEGER,did_vote INTEGER,post_author TEXT,post_price DOUBLE,post_rating DOUBLE);"

    invoke-virtual {p1, v1}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 852
    const-string v1, "CREATE UNIQUE INDEX idx_spicydeals ON spicydeals (id);"

    invoke-virtual {p1, v1}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 854
    const-string v1, "spicydeals"

    invoke-virtual {v0, v3, v1}, Landroid/database/sqlite/SQLiteStatement;->bindString(ILjava/lang/String;)V

    .line 855
    invoke-virtual {v0, v4, v6, v7}, Landroid/database/sqlite/SQLiteStatement;->bindLong(IJ)V

    .line 856
    const-string v1, "Alle"

    invoke-virtual {v0, v5, v1}, Landroid/database/sqlite/SQLiteStatement;->bindString(ILjava/lang/String;)V

    .line 857
    invoke-virtual {v0}, Landroid/database/sqlite/SQLiteStatement;->executeInsert()J

    .line 859
    const-string v1, "spicydeals"

    invoke-virtual {v0, v3, v1}, Landroid/database/sqlite/SQLiteStatement;->bindString(ILjava/lang/String;)V

    .line 860
    invoke-virtual {v0, v4, v8, v9}, Landroid/database/sqlite/SQLiteStatement;->bindLong(IJ)V

    .line 861
    const-string v1, "Deals"

    invoke-virtual {v0, v5, v1}, Landroid/database/sqlite/SQLiteStatement;->bindString(ILjava/lang/String;)V

    .line 862
    invoke-virtual {v0}, Landroid/database/sqlite/SQLiteStatement;->executeInsert()J

    .line 864
    const-string v1, "spicydeals"

    invoke-virtual {v0, v3, v1}, Landroid/database/sqlite/SQLiteStatement;->bindString(ILjava/lang/String;)V

    .line 865
    const-wide/16 v1, 0x2

    invoke-virtual {v0, v4, v1, v2}, Landroid/database/sqlite/SQLiteStatement;->bindLong(IJ)V

    .line 866
    const-string v1, "Gutscheine"

    invoke-virtual {v0, v5, v1}, Landroid/database/sqlite/SQLiteStatement;->bindString(ILjava/lang/String;)V

    .line 867
    invoke-virtual {v0}, Landroid/database/sqlite/SQLiteStatement;->executeInsert()J

    .line 869
    const-string v1, "spicydeals"

    invoke-virtual {v0, v3, v1}, Landroid/database/sqlite/SQLiteStatement;->bindString(ILjava/lang/String;)V

    .line 870
    const-wide/16 v1, 0x3

    invoke-virtual {v0, v4, v1, v2}, Landroid/database/sqlite/SQLiteStatement;->bindLong(IJ)V

    .line 871
    const-string v1, "Kostenloses"

    invoke-virtual {v0, v5, v1}, Landroid/database/sqlite/SQLiteStatement;->bindString(ILjava/lang/String;)V

    .line 872
    invoke-virtual {v0}, Landroid/database/sqlite/SQLiteStatement;->executeInsert()J

    .line 874
    const-string v1, "spicydeals"

    invoke-virtual {v0, v3, v1}, Landroid/database/sqlite/SQLiteStatement;->bindString(ILjava/lang/String;)V

    .line 875
    const-wide/16 v1, 0x4

    invoke-virtual {v0, v4, v1, v2}, Landroid/database/sqlite/SQLiteStatement;->bindLong(IJ)V

    .line 876
    const-string v1, "Lokales"

    invoke-virtual {v0, v5, v1}, Landroid/database/sqlite/SQLiteStatement;->bindString(ILjava/lang/String;)V

    .line 877
    invoke-virtual {v0}, Landroid/database/sqlite/SQLiteStatement;->executeInsert()J

    .line 878
    return-void
.end method

.method public onUpgrade(Landroid/database/sqlite/SQLiteDatabase;II)V
    .locals 3
    .parameter "db"
    .parameter "oldVersion"
    .parameter "newVersion"

    .prologue
    .line 890
    sget-boolean v0, Lcom/opongo/blogapp/manager/DatabaseManager;->DEBUG:Z

    if-eqz v0, :cond_0

    .line 891
    sget-object v0, Lcom/opongo/blogapp/manager/DatabaseManager;->TAG:Ljava/lang/String;

    new-instance v1, Ljava/lang/StringBuilder;

    const-string v2, "Upgrading database, this will drop all tables! oldVersion:"

    invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1, p2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, " newVersion:"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 893
    :cond_0
    const-string v0, "DROP TABLE IF EXISTS recent_posts"

    invoke-virtual {p1, v0}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 894
    const-string v0, "DROP TABLE IF EXISTS mostread_posts"

    invoke-virtual {p1, v0}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 895
    const-string v0, "DROP TABLE IF EXISTS comments"

    invoke-virtual {p1, v0}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 896
    const-string v0, "DROP TABLE IF EXISTS mostcommented_posts"

    invoke-virtual {p1, v0}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 897
    const-string v0, "DROP TABLE IF EXISTS search_posts"

    invoke-virtual {p1, v0}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 898
    const-string v0, "DROP TABLE IF EXISTS bookmarks"

    invoke-virtual {p1, v0}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 899
    const-string v0, "DROP TABLE IF EXISTS categories"

    invoke-virtual {p1, v0}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 900
    const-string v0, "DROP TABLE IF EXISTS blogtyp"

    invoke-virtual {p1, v0}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 901
    const-string v0, "DROP TABLE IF EXISTS post_blogtype"

    invoke-virtual {p1, v0}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 903
    const-string v0, "DROP TABLE IF EXISTS spicydeals"

    invoke-virtual {p1, v0}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 904
    invoke-virtual {p0, p1}, Lcom/opongo/blogapp/manager/DatabaseManager$OpenHelper;->onCreate(Landroid/database/sqlite/SQLiteDatabase;)V

    .line 905
    return-void
.end method
